package com.sunchis.demo.model.dept;

import java.io.Serializable;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinColumns;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.apache.ibatis.type.Alias;

import com.sunchis.demo.model.User;

@Entity
@Table(name = "t_department")
@Alias(value = "Department")
@SuppressWarnings("serial")
public class Department implements Serializable {
	private int deptId;
	private String deptName;
	private List<User> userList;
	
	public Department(){
	}
	
	public Department(int deptId){
		this.deptId = deptId;
	}

	@Id
	public int getDeptId() {
		return deptId;
	}

	public void setDeptId(int deptId) {
		this.deptId = deptId;
	}

	public String getDeptName() {
		return deptName;
	}

	public void setDeptName(String deptName) {
		this.deptName = deptName;
	}

	@OneToMany(cascade={CascadeType.ALL})
	@JoinColumns(value = {@JoinColumn(name = "deptId")})
	public List<User> getUserList() {
		return userList;
	}

	public void setUserList(List<User> userList) {
		this.userList = userList;
	}
}
